<?php
declare(strict_types=1);
namespace App\Controller\WebApi\v1;

use App\Controller\AbstractController;
use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\HttpServer\Annotation\RequestMapping;
use Hyperf\HttpServer\Annotation\Controller;
use Service\PayService\MnappPayService;

/**
 * 支付接口
 * @author chenshubo
 * @Controller(prefix="/webapi/v1/pay")
 */
class PayController extends AbstractController
{
    /**
     * 用户预处理支付接口
     * @RequestMapping(path="userPay", methods="post")
     */
    public function userPay(RequestInterface $request)
    {
        return MnappPayService::instance()->userPay(
            (int)$request->input('cid'),
            (int)$request->input('mn_sid'),
            (int)$request->input('mnid'),
            (int)$request->input('pay_way'),
            [
                'order_no'      => '20230506144645454',
                'money'         => '0.01',
                'order_id'      => 256563,
                'remark'        => '在线支付',
                'open_id'       => 'okC5d45yBy0i03AqAEZyeGCAxu2Y'
            ]
            );
    }
}